/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Caps
 */
@Entity
@Table(name = "turma")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Turma.findAll", query = "SELECT t FROM Turma t"),
    @NamedQuery(name = "Turma.findByPrdltvPrdletivo", query = "SELECT t FROM Turma t WHERE t.turmaPK.prdltvPrdletivo = :prdltvPrdletivo"),
    @NamedQuery(name = "Turma.findByCrsCodigo", query = "SELECT t FROM Turma t WHERE t.turmaPK.crsCodigo = :crsCodigo"),
    @NamedQuery(name = "Turma.findByDscCodigo", query = "SELECT t FROM Turma t WHERE t.turmaPK.dscCodigo = :dscCodigo"),
    @NamedQuery(name = "Turma.findByTrmcbcSerie", query = "SELECT t FROM Turma t WHERE t.turmaPK.trmcbcSerie = :trmcbcSerie"),
    @NamedQuery(name = "Turma.findByTrmcbcSequencia", query = "SELECT t FROM Turma t WHERE t.turmaPK.trmcbcSequencia = :trmcbcSequencia"),
    @NamedQuery(name = "Turma.findByTrmCodigo", query = "SELECT t FROM Turma t WHERE t.turmaPK.trmCodigo = :trmCodigo"),
    @NamedQuery(name = "Turma.findByTblgrlitmCdggrpsubturma", query = "SELECT t FROM Turma t WHERE t.tblgrlitmCdggrpsubturma = :tblgrlitmCdggrpsubturma"),
    @NamedQuery(name = "Turma.findByTrmNmrvagas", query = "SELECT t FROM Turma t WHERE t.trmNmrvagas = :trmNmrvagas"),
    @NamedQuery(name = "Turma.findByTrmDtincaulas", query = "SELECT t FROM Turma t WHERE t.trmDtincaulas = :trmDtincaulas"),
    @NamedQuery(name = "Turma.findByTrmDttrmaulas", query = "SELECT t FROM Turma t WHERE t.trmDttrmaulas = :trmDttrmaulas"),
    @NamedQuery(name = "Turma.findByTrmTtlhrsteoricas", query = "SELECT t FROM Turma t WHERE t.trmTtlhrsteoricas = :trmTtlhrsteoricas"),
    @NamedQuery(name = "Turma.findByTrmTtlhrspraticas", query = "SELECT t FROM Turma t WHERE t.trmTtlhrspraticas = :trmTtlhrspraticas"),
    @NamedQuery(name = "Turma.findByTrmTtlhrsestagio", query = "SELECT t FROM Turma t WHERE t.trmTtlhrsestagio = :trmTtlhrsestagio"),
    @NamedQuery(name = "Turma.findByTrmTtlhrsaps", query = "SELECT t FROM Turma t WHERE t.trmTtlhrsaps = :trmTtlhrsaps"),
    @NamedQuery(name = "Turma.findByTrmTtlhrspcc", query = "SELECT t FROM Turma t WHERE t.trmTtlhrspcc = :trmTtlhrspcc")})
public class Turma implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "turma")
    private List<Questionario> questionarioList;
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TurmaPK turmaPK;
    @Size(max = 2147483647)
    @Column(name = "tblgrlitm_cdggrpsubturma")
    private String tblgrlitmCdggrpsubturma;
    @Column(name = "trm_nmrvagas")
    private Integer trmNmrvagas;
    @Column(name = "trm_dtincaulas")
    @Temporal(TemporalType.DATE)
    private Date trmDtincaulas;
    @Column(name = "trm_dttrmaulas")
    @Temporal(TemporalType.DATE)
    private Date trmDttrmaulas;
    @Column(name = "trm_ttlhrsteoricas")
    private Integer trmTtlhrsteoricas;
    @Column(name = "trm_ttlhrspraticas")
    private Integer trmTtlhrspraticas;
    @Column(name = "trm_ttlhrsestagio")
    private Integer trmTtlhrsestagio;
    @Column(name = "trm_ttlhrsaps")
    private Integer trmTtlhrsaps;
    @Column(name = "trm_ttlhrspcc")
    private Integer trmTtlhrspcc;
    @ManyToMany(mappedBy = "turmaList")
    private List<Docente> docenteList;
    @JoinColumn(name = "dsc_codigo", referencedColumnName = "dsc_codigo", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Disciplina disciplina;
    @JoinColumn(name = "crs_codigo", referencedColumnName = "crs_codigo", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Curso curso;

    public Turma() {
    }

    public Turma(TurmaPK turmaPK) {
        this.turmaPK = turmaPK;
    }

    public Turma(int prdltvPrdletivo, String crsCodigo, String dscCodigo, int trmcbcSerie, int trmcbcSequencia, String trmCodigo) {
        this.turmaPK = new TurmaPK(prdltvPrdletivo, crsCodigo, dscCodigo, trmcbcSerie, trmcbcSequencia, trmCodigo);
    }

    public TurmaPK getTurmaPK() {
        return turmaPK;
    }

    public void setTurmaPK(TurmaPK turmaPK) {
        this.turmaPK = turmaPK;
    }

    public String getTblgrlitmCdggrpsubturma() {
        return tblgrlitmCdggrpsubturma;
    }

    public void setTblgrlitmCdggrpsubturma(String tblgrlitmCdggrpsubturma) {
        this.tblgrlitmCdggrpsubturma = tblgrlitmCdggrpsubturma;
    }

    public Integer getTrmNmrvagas() {
        return trmNmrvagas;
    }

    public void setTrmNmrvagas(Integer trmNmrvagas) {
        this.trmNmrvagas = trmNmrvagas;
    }

    public Date getTrmDtincaulas() {
        return trmDtincaulas;
    }

    public void setTrmDtincaulas(Date trmDtincaulas) {
        this.trmDtincaulas = trmDtincaulas;
    }

    public Date getTrmDttrmaulas() {
        return trmDttrmaulas;
    }

    public void setTrmDttrmaulas(Date trmDttrmaulas) {
        this.trmDttrmaulas = trmDttrmaulas;
    }

    public Integer getTrmTtlhrsteoricas() {
        return trmTtlhrsteoricas;
    }

    public void setTrmTtlhrsteoricas(Integer trmTtlhrsteoricas) {
        this.trmTtlhrsteoricas = trmTtlhrsteoricas;
    }

    public Integer getTrmTtlhrspraticas() {
        return trmTtlhrspraticas;
    }

    public void setTrmTtlhrspraticas(Integer trmTtlhrspraticas) {
        this.trmTtlhrspraticas = trmTtlhrspraticas;
    }

    public Integer getTrmTtlhrsestagio() {
        return trmTtlhrsestagio;
    }

    public void setTrmTtlhrsestagio(Integer trmTtlhrsestagio) {
        this.trmTtlhrsestagio = trmTtlhrsestagio;
    }

    public Integer getTrmTtlhrsaps() {
        return trmTtlhrsaps;
    }

    public void setTrmTtlhrsaps(Integer trmTtlhrsaps) {
        this.trmTtlhrsaps = trmTtlhrsaps;
    }

    public Integer getTrmTtlhrspcc() {
        return trmTtlhrspcc;
    }

    public void setTrmTtlhrspcc(Integer trmTtlhrspcc) {
        this.trmTtlhrspcc = trmTtlhrspcc;
    }

    @XmlTransient
    public List<Docente> getDocenteList() {
        return docenteList;
    }

    public void setDocenteList(List<Docente> docenteList) {
        this.docenteList = docenteList;
    }

    public Disciplina getDisciplina() {
        return disciplina;
    }

    public void setDisciplina(Disciplina disciplina) {
        this.disciplina = disciplina;
    }

    public Curso getCurso() {
        return curso;
    }

    public void setCurso(Curso curso) {
        this.curso = curso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (turmaPK != null ? turmaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Turma)) {
            return false;
        }
        Turma other = (Turma) object;
        if ((this.turmaPK == null && other.turmaPK != null) || (this.turmaPK != null && !this.turmaPK.equals(other.turmaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Turma[ turmaPK=" + turmaPK + " ]";
    }

    @XmlTransient
    public List<Questionario> getQuestionarioList() {
        return questionarioList;
    }

    public void setQuestionarioList(List<Questionario> questionarioList) {
        this.questionarioList = questionarioList;
    }
    
}
